
package com.pikts.acc2blender;

import android.content.Context;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
public class Text2Speech implements OnInitListener {
  Context context;

  TextToSpeech talker;

  public Text2Speech(Context context) {
    	this.context=context;
  }

  public void initialize() {
    	talker = new TextToSpeech(context, this);
  }

  public void say(String text2say) {
    	talker.speak(text2say, TextToSpeech.QUEUE_FLUSH, null);
  }

  @Override
  public void onInit(int status) {
		if (status == TextToSpeech.SUCCESS) {
		say("Program has been succesfully initialized");
		}
  }

  public void destroy() {
		if (talker != null) {
			talker.stop();
			talker.shutdown();
		}
  }

}
